You can apply user-defined functions in Office Calc in the following ways:
ユーザー定義の関数は、Office Calc で次のように操作します:
You can define your own functions using the Basic-IDE. This method requires a basic knowledge of programming.
Basic-IDE を使用すれば、プログラミングの詳しい知識がなくても、独自の関数を作成できます。
You can program functions as add-ins. This method requires an advanced knowledge of programming.
関数をアドインとしてプログラミングする方法を説明しています。この方法はプログラミングに関する高度な知識を必要とします。
Choose .
を選択します。
Click the Edit button. You will now see the Basic IDE.
編集 ボタンをクリックして Basic-IDE を開きます。
Enter the function code. In this example, we define a VOL(a; b; c) function that calculates the volume of a rectangular solid with side lengths a, b and c:
関数コードを入力します。ここでは、VOL(a; b; c) 関数を指定します。この関数は、辺の長さが a、b、および c の直方体の体積を計算します。
Function VOL(a, b, c)
VOL = a*b*c
End Function
Close the Basic-IDE window.
Basic-IDE ウィンドウを閉じます。
Your function is automatically saved in the default module and is now available. If you apply the function in a Calc document that is to be used on another computer, you can copy the function to the Calc document as described in the next section.
ユーザーが定義した関数は自動的に標準モジュールに保存されるので、いつでも使用できます。この関数を別のコンピュータの Calc ドキュメントでも使用できるようにするには、関数を Calc ドキュメントにコピーします。次の節で詳細が説明されています。
In stage 2 of "Defining A Function Using Office Basic", in the Macro dialog you clicked on Edit . As the default, in the Macro from field the My Macros - Standard - Module1 module is selected. The Standard library resides locally in your user directory.
「独自の関数を Office Basic で定義する」の手順 2 で マクロ ダイアログの 編集 をクリックしました。標準設定では マイマクロ → Standard → Module1 で マクロの記録先 が選択されています。この Standard ライブラリは、ユーザーディレクトリにあります。
If you want to copy the user-defined function to a Calc document:
ユーザーが定義した関数を Calc ドキュメントにコピーするには、次の操作を行ないます:
Choose .
を選択します。
In the Macro from field select My Macros - Standard - Module1 and click Edit.
マクロの記録先 フィールドから マイマクロ → Standard → Module1 を選択した上で 編集 ボタンをクリックします。
In the Basic-IDE, select the source of your user-defined function and copy it to the clipboard.
Basic-IDE でユーザーが定義した関数のソースを選択して、クリップボードにコピーします。
Close the Basic-IDE.
Basic-IDE を閉じます。
Choose .
を選択します。
In the Macro from field select (Name of the Calc document) - Standard - Module1. Click Edit.
マクロの記録先 フィールドから (Calc ドキュメント名) → Standard → Module1 を選択して 編集 ボタンをクリックします。
Paste the clipboard contents in the Basic-IDE of the document.
ドキュメントの Basic-IDE にクリップボードの内容を貼り付けます。
Once you have defined the function VOL(a; b; c) in the Basic-IDE, you can apply it the same way as the built-in functions of Office Calc.
Basic-IDE で定義した関数 VOL(a; b; c) は、Office Calc のほかの組み込み関数と同じ方法で使用できます。
Open a Calc document and enter numbers for the function parameters a, b, and c in cells A1, B1, and C1.
Calc ドキュメントを開いて、セル A1、B1、および C1 に関数の引数の数値である a、b、および c を入力します。
Set the cursor in another cell and enter the following:
カーソルを別のセルに置き、次のように入力します:
=VOL(A1;B1;C1)
=VOL(A1;B1;C1)
The function is evaluated and you will see the result in the selected cell.
関数が適用され、結果が選択したセルに表示されます。